/**
 * @Description:根据元素获取面包屑导航路径输出到指定元素
 * @param element 页面元素，#div或者.class
 */
function outPutNavigationByElement(element){
	getNodeNavigation();
	
	var rootMenu = window.localStorage?localStorage.getItem("currentMenu"):getCookie("currentMenu");
	var currentMenu = window.localStorage?localStorage.getItem("currentNodeMenu"):getCookie("currentNodeMenu");
	var nodeUrl = window.localStorage?localStorage.getItem("nodeUrl"):getCookie("nodeUrl");
	
	$(element).html(rootMenu+"&nbsp;&gt;&nbsp;<a href='"+nodeUrl+"'>"+currentMenu+"</a>");
}

/**
 * 根据默认元素获取面包屑路径输出
 */
function outPutNavigation(){
	getNodeNavigation();
	var rootMenu = window.top.$(".ks-show").find(".dd-title-nav").html();
	if(!rootMenu){
		rootMenu=getCookie("currentMenu");
	}
	var currentMenu = localStorage.getItem("currentNodeMenu");
	if(!currentMenu){
		currentMenu=getCookie("currentNodeMenu");
	}
	var nodeUrl = localStorage.getItem("nodeUrl");
	if(!nodeUrl){
		nodeUrl=getCookie("nodeUrl");
	}
	$(".cur-position").html(rootMenu+"&nbsp;&gt;&nbsp;<a href='"+nodeUrl+"'>"+currentMenu+"</a>");
}
$(function() {
	outPutNavigation();
})

/**
 * 获取父节点选中的tabPanel菜单标题名称
 */
function getNodeNavigation(){
	var currentMenu = parent.$("#tab-menus").tabs('getSelected').panel('options').title;
	var obj =parent.$(".ks-itme-active").find("h3 a").attr("onclick");
	if(obj){
		var	nodeUrl= obj.substring(9,(obj.indexOf(",")-1));
		if (window.localStorage) {
			localStorage.setItem("nodeUrl", nodeUrl);
		} else {
		   setCookie("nodeUrl", nodeUrl);	
		}
	}
	
	
	if(!currentMenu)
		return;
	if (window.localStorage) {
		localStorage.setItem("currentNodeMenu", currentMenu);
	} else {
	   setCookie("currentNodeMenu", currentMenu);	
	}
}